


class Dog(object):

    def __init__(self,name):
        self.name = name
        self.__food = None
#属性方法：把一个方法变成一个静态属性
    @property   #attribute
    def eat(self):
        print('%s is eating %s'%(self.name,self.__food))
    @eat.setter
    def eat(self,food):
        print('set to food',food)
        self.__food = food
    @eat.deleter
    def eat(self):
        del self.__food
        print('删完了')
    def talk(self):
        print('%s is talking '% self.name)
d = Dog('ouyang')
d.eat
# d.eat("baozi")#不可以传参数
# d.eat = 'baozi'#默认赋值也不可以
d.eat = "baozi"
d.eat

del d.eat#属性方法，，默认无法删除